<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ include file="config.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
	<script type="text/javascript" src="${ctx}/js/jquery-3.3.1.min.js"></script>
	<script type="text/javascript" src="${ctx}/js/adminCommodityPage.js"></script>
	<link href="${ctx}/css/adminCommodityPage.css" rel="stylesheet"/>
</head>
<body>
<div class="handler4">	
	<div>
		<span>商品分页管理</span><br/><br/>
		
		<table class="myTable1" >
			<tr class="tr1">
				<td colspan="3"><button id="add">添加新商品</button></td>
			</tr>
			<tr class="tr2">
				<td class="td1"><span>所属大类：</span><select id="bigType" class="${bigType}"></select></td>
				<td class="td1"><span>所属小类：</span><select  id="littleType" class="${littleType}"></select></td>
				<td class="td1"><span>关键字：</span><input id="keyWord" type="text" value="${keyWord}" /></td>
			</tr>
			<tr class="tr3">
				<td class="td1" colspan="2">价格：<input id="minPrice" type="text" value="${minPrice}" />至：
				<input value="${maxPrice}" id="maxPrice" type="text"/><span>价格是数字</span> </td>
				<td class="td2"><button id="search">提交</button> </td>
			</tr>
		</table>
		
		<table class="myTable" >
			<tr class="tr1">
				<td class="td1"><span>商品图片</span></td>
				<td class="td1"><span>商品名称</span></td>
				<td class="td1"><span>单价</span></td>
				<td class="td1"><span>库存</span></td>
				<td class="td1"><span>操作</span></td>
			</tr>
			<c:forEach items="${pageCommPage.list}" var="commodity">
				<tr id="${commodity.id}">
					<td class="td1"><img alt="" src="${commodity.imgpath}" /></td>
					<td class="td1"><span>${commodity.name}</span></td>
					<td class="td1"><span>￥${commodity.price}</span></td>
					<td class="td1">${commodity.num}</td>
					<td class="td1"><button class="delete">删除</button><button class="edit">修改</button> </td>
				</tr>
			</c:forEach>
			
		</table>	
		</div>
		<div class="bottom">
			当前<span id="currentPage">${pageCommPage.currentPage + 1}</span>/<span id="totalPage">${pageCommPage.totalPage}</span>页，
			共${pageCommPage.totalCount}条记录&nbsp&nbsp&nbsp&nbsp&nbsp
			<a href="#" id="firstPage">首页</a>&nbsp&nbsp&nbsp<a href="#" id="parentPage">上一页</a> &nbsp&nbsp&nbsp&nbsp
			<a href="#" id="nextPage">下一页</a>&nbsp&nbsp&nbsp&nbsp<a href="#" id="lastPage">尾页</a>&nbsp&nbsp&nbsp&nbsp每页
			<input id="pageSize" style="width: 31px;" type="number" min="1" max="5" value="${pageCommPage.pageSize}">
			 条记录&nbsp&nbsp&nbsp&nbsp转到
			<select id="selectPage">
				<c:forEach begin="1" end="${pageCommPage.totalPage}" var="currentPage" >
					<c:choose>
						<c:when test="${(pageCommPage.currentPage+1) == currentPage}">
				    		<option selected="selected">${currentPage}</option>
						</c:when>
						<c:otherwise>
				    		<option>${currentPage}</option>
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</select>页
			
		</div>
</div>
</body>
</html>